package mc0210;

import java.util.Scanner;

public class Main {
	//计算next数组（前缀表）
	//该方法另一个常用名称为prefix_function
	static int[] get_next(String s) {
	    int n = s.length();
	    int[] pi = new int[n];
	    for (int i = 1; i < n; i++) {
	        int j = pi[i - 1];
	        while (j > 0 && s.charAt(i) != s.charAt(j)) {
	            j = pi[j - 1];
	        }
	        if (s.charAt(i) == s.charAt(j)) {
	            j++;
	        }
	        pi[i] = j;
	    }
	    return pi;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//读入原始字符串
		String str1 = sc.nextLine();
		//计算前缀表（模板）
		int[] next = get_next(str1);
		
		//源字符串掐头去尾（单字符）
		String str2 = str1.substring(1);//掐头
		str2 = str2.substring(0, str2.length()-1);//去尾
		
		//System.out.println(str2);
		//System.out.println(Arrays.toString(next));
		
		int len = str1.length();//原始字符串长度
		
		//原字符串最大公共前缀长度
		int temp = next[len-1];
		
		while(temp!=0) {
			//获取最长前缀字符串
			String lps = str1.substring(0, temp);
			//System.out.println(lps);
			//如果被str2包含则是真子串
			if(str2.contains(lps)) {
				System.out.print(lps);
				return;
			}
			//继续在最长前缀串里面找最长前缀
			temp = next[temp-1];
		}
		
		//无满足条件的前缀
		System.out.println("No");

	}

}
